//
//  HomeTitleBtn.swift
//  Weibo007
//
//  Created by 闫崇 on 15/12/17.
//  Copyright © 2015年 闫崇. All rights reserved.
//

import UIKit

class HomeTitleBtn: UIButton {

    
    class func button(title:String) ->HomeTitleBtn {
        
        let btn = HomeTitleBtn()
        btn.setTitle(title + " ", forState: UIControlState.Normal)
        btn.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(17.0)
        btn.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        btn.sizeToFit()
        
        return btn
    }
    
    
    
    
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        //改变图片和文字的位置
//        var tFrame = titleLabel!.frame
//        tFrame.origin.x = 0
//        titleLabel!.frame = tFrame
//        
//        var iFrame = imageView!.frame
//        iFrame.origin.x = tFrame.size.width
//        imageView!.frame = iFrame
        
        //在 swift 中能够直接修改frame 内部的值
        titleLabel!.frame.origin.x = 0
        imageView!.frame.origin.x = titleLabel!.frame.size.width
        
        
    }

}
